Skip to content

Fix Zod schema input types for fields with defaults#304

Merged
xuyushun441-sys merged 2 commits intomainfrom
copilot/update-workflow-integration
Jan 27, 2026
Merged

Fix Zod schema input types for fields with defaults#304
xuyushun441-sys merged 2 commits intomainfrom
copilot/update-workflow-integration

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Jan 27, 2026

TypeScript compilation failed because Zod schemas with .default() without .optional() require fields in input types, breaking user configurations that omit defaulted fields.

Changes

  • app.zod.ts, object.zod.ts: Changed .default(value).optional().default(value) for active, isDefault, isSystem, abstract, datasource
  • stack.zod.ts: Changed defineStack parameter type from z.infer<> (output) to z.input<> (input)

Impact

Configurations can now omit fields with defaults:

// Before: TypeScript error - missing required properties 'active', 'isSystem', 'abstract', 'datasource'
export const TodoTask = ObjectSchema.create({
  name: 'todo_task',
  label: 'Todo Task',
  fields: { /* ... */ }
});

// After: Works correctly - defaults applied at runtime
export const TodoTask = ObjectSchema.create({
  name: 'todo_task',
  label: 'Todo Task',
  fields: { /* ... */ }
  // active, isSystem, abstract, datasource are optional
});

Pattern applies to all Zod schemas with runtime defaults throughout the spec package.

Original prompt

引用: https://github.com/objectstack-ai/spec/actions/runs/21387277207/job/61566130355#step:8:1


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

@vercel
Copy link
Copy Markdown

vercel bot commented Jan 27, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Review Updated (UTC)
spec Ready Ready Preview, Comment Jan 27, 2026 7:08am

Request Review

Co-authored-by: hotlong <50353452+hotlong@users.noreply.github.com>
Copilot AI changed the title [WIP] Update workflow integration for better performance Fix Zod schema input types for fields with defaults Jan 27, 2026
Copilot AI requested a review from hotlong January 27, 2026 07:09
@xuyushun441-sys xuyushun441-sys marked this pull request as ready for review January 27, 2026 07:11
@xuyushun441-sys xuyushun441-sys merged commit 09e1687 into main Jan 27, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants